:root {
    --bg-color: #f0f2f5;
    --sidebar-bg: #ffffff;
    --main-bg: #f7f7f8;
    --border-color: #e5e7eb;
    --text-color: #111827;
    --text-secondary: #6b7280;
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --input-bg: #f9fafb;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-size: 14px;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.container { display: flex; width: 100%; height: 100%; }

.sidebar {
    width: 380px;
    flex-shrink: 0;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.header { padding-bottom: 16px; margin-bottom: 24px; border-bottom: 1px solid var(--border-color); }
.header h2 { margin: 0; }
.header p { margin: 4px 0 0; color: var(--text-secondary); }

.main-content { flex-grow: 1; background-color: var(--main-bg); padding: 24px; overflow-y: auto; }
#result-panel { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }

.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 500; margin-bottom: 8px; }

input[type="password"], textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background-color: var(--input-bg);
    transition: border-color 0.2s;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.image-drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background-color: var(--input-bg);
    transition: border-color 0.2s;
}
.image-drop-zone:hover { border-color: var(--primary-color); }
#image-preview { max-width: 100%; max-height: 100%; object-fit: contain; }
#upload-placeholder { color: var(--text-secondary); text-align: center; }
#clear-image-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 24px;
    text-align: center;
    cursor: pointer;
}

.slider-group .slider-label { display: flex; justify-content: space-between; align-items: center; }
.slider-group .slider-label span { font-weight: 600; color: var(--primary-color); }
.slider-group small { display: block; margin-top: 6px; font-size: 12px; color: var(--text-secondary); }

input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; background: #ddd; border-radius: 5px; outline: none; margin-top: 8px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; background: var(--primary-color); cursor: pointer; border-radius: 50%; }
input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; background: var(--primary-color); cursor: pointer; border-radius: 50%; }

#generate-btn {
    width: 100%; padding: 12px; background-color: var(--primary-color); color: white; border: none;
    border-radius: 6px; font-size: 16px; font-weight: 500; cursor: pointer; transition: background-color 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: auto;
}
#generate-btn:hover { background-color: var(--primary-hover); }
#generate-btn:disabled { background-color: #9ca3af; cursor: not-allowed; }

.placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--text-secondary); }
#image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(256px, 1fr)); gap: 16px; width: 100%; }
.image-container { position: relative; overflow: hidden; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.image-container img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hidden { display: none; }
.spinner { border: 5px solid rgba(0, 0, 0, 0.1); width: 50px; height: 50px; border-radius: 50%; border-left-color: var(--primary-color); animation: spin 1s ease infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.error { color: #b91c1c; background-color: #fee2e2; border: 1px solid #fca5a5; padding: 15px; border-radius: 6px; text-align: center; max-width: 80%; }
